package com.common.base.widget.indicators

import android.content.Context
import net.lucode.hackware.magicindicator.buildins.ArgbEvaluatorHolder
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.SimplePagerTitleView


/**
 *
 * 作者：sosou
 *
 * 版本：1.0
 *
 * 创建日期：24/7/2025
 *
 * 描述：两种颜色过渡的指示器标题
 *
 * 修订历史：
 *
 */
class ColorTransitionPagerTitleView(context: Context?) :
    SimplePagerTitleView(context) {
    override fun onLeave(index: Int, totalCount: Int, leavePercent: Float, leftToRight: Boolean) {
        val color = ArgbEvaluatorHolder.eval(leavePercent, mSelectedColor, mNormalColor)
        setTextColor(color)
    }

    override fun onEnter(index: Int, totalCount: Int, enterPercent: Float, leftToRight: Boolean) {
        val color = ArgbEvaluatorHolder.eval(enterPercent, mNormalColor, mSelectedColor)
        setTextColor(color)
    }

    override fun onSelected(index: Int, totalCount: Int) {}
    override fun onDeselected(index: Int, totalCount: Int) {}
}